<?php

namespace App\Http\Resources\Train\Trip;

use App\Trip\IdentityCode\IdentityCode;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
use JsonSerializable;

class InviteJoinsResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param Request $request
     *
     * @return array|Arrayable|JsonSerializable
     */
    public function toArray($request)
    {
        $join                  = parent::toArray($request);
        $idc                   = new IdentityCode($join['identity_code']);
        $join['identity_code'] = $idc->hide();
        return $join;
    }
}
